﻿using RpcExtend.Collect;
using RpcExtend.Service.Interface;
using RpcExtendModel.Trace;
using RpcHelper;
using RpcModel;

namespace RpcExtend.Service.Service
{
    [RpcClient.Attr.ClassLifetimeAttr(RpcClient.Attr.ClassLifetimeType.单例)]
    internal class TraceService : ITraceService
    {
        private ITraceCollect _Trace;
        private ITraceLogCollect _TraceLog;

        public TraceService(ITraceCollect trace, ITraceLogCollect traceLog)
        {
            this._Trace = trace;
            this._TraceLog = traceLog;
        }

        public void Add(SysTraceLog[] logs, MsgSource source)
        {
            logs.ForEach(c =>
            {
                _Trace.Add(c, source);
                _TraceLog.Add(c, source);
            });
        }
    }
}
